<template>
  <el-checkbox-group v-model="model" v-bind="$attrs">
    <el-checkbox v-for="item in checkedOptions" :key="item[sign.id]" :label="item[sign.label]" :value="sign.value? item : item[sign.value]"></el-checkbox>
  </el-checkbox-group>
</template>

<script lang="ts" setup>
import { onMounted, computed } from 'vue'
import { CheckedPropsInterface } from './types'

const {store} = defineProps<CheckedPropsInterface>()
const model = defineModel({required: true})

// 请求
onMounted(async ()=>{
  if (store.autoload) {
    await store.searchData()
  }
})
// 获取值
const checkedOptions = computed(()=>{
  return store.view.value.data || []
})

</script>